/************** init.html **************/
function query_invAccount(page) {
	sys_loading();
	var parm = $('#queryinvAccountForm').serialize() + (page != null ? ('&page=' + page) : '');
	var url = create_url('invAccount-query');
	sys_record_parm('invAccount',parm);
	$.ajax({type:'POST', url:url, data:parm,
		success: function(result) {
			sys_loading_close();
			$('#ResultList').html(result);
		}
	});
}


function shield_invAccount(code, name) {
	$.Zebra_Dialog('确定是否屏蔽'+name + ' 吗？',{
	'type': 'question',
	'title': '警告' ,
	'buttons':[
       {caption:'屏蔽',callback:function() {
    	   var url = create_url('invAccount-shield');
    	   aidExecute_invAccount(code, url);
		}},
       {caption:'取消',callback:function(){}
       }]
	});
}

function unshield_invAccount(code, name) {
	$.Zebra_Dialog('确定要给'+name + ' 解除屏蔽吗？',{
	'type': 'question',
	'title': '警告' ,
	'buttons':[
       {caption:'解除',callback:function() {
    	   var url = create_url('invAccount-unshield');
    	   aidExecute_invAccount(code, url);
		}},
       {caption:'取消',callback:function(){}
       }]
	});
}
function aidExecute_invAccount(code, url) {
	var parm = {'code':code};
	sys_submiting();
	$.ajax({type:'POST', url:url, data:parm,
		success: function(result) {
			sys_submiting_close();
			if ('success' == result) {
				query_invAccount();
			} else {
				$.Zebra_Dialog('操作失败，请刷新页面再次尝试，如果问题依然存在，请联系管理员!');
			}
		}
	});
}
function save_invAccount() {
	var parm = $('#editinvAccountForm').serialize();
	var url = create_url('invAccount-save');
	sys_submiting();
	$.ajax({type:'POST', url:url, data:parm,
		success: function(result) {
			sys_submiting_close();
			if (result == 'success') {
				sys_msg('操作成功!');
				sys_load_handle('invAccount');
			} else if(result == 'exists') {
				sys_msg('名称重复!');
			} else {
				sys_msg('操作失败！')
			}
		}
	});
}


//查询类型
function aidQuery_invAccount(page) {
	sys_loading();
	var parm = $('#aidQueryForm').serialize() + (page != null ? ('&page=' + page) : '');
	var url = create_url('invAccount-aidList');
	$.ajax({type:'POST', url:url, data:parm,success: function(result) {
			sys_loading_close();
			$('#aidResultList').html(result);
			}
		});
	}
function selectType_invAccount() {
	var url = create_url('invAccount-aidInit');
	var parm = {'id':'atc', 'name':'atn'};
	$.colorbox({overlayClose:false, href:url, data:parm, close:'[关闭]', width:'900px', height:'700px', open:true, 
			onClosed:function(){
			}
		});
	}

//选择
function choose_invAccount(code, name) {
	$('#atc').val(code);
	$('#atn').val(name);
	$.fn.colorbox.close();
}
